const enterpriseVue = new Vue({
    el: '#app',
    data() {
      return {
        form:{
            Role_Name: '',
        },
        loading: false,
        Role_Name: '',
        Role_Id:'',
        Role_Status:'',
        Status:[
            {
                Option: '生效',
                value:'N'
            },
            {
                Option: '失效',
                value:'S'
            }
        ]
      }
    },
    mounted() {
        this.Role_Name = sessionStorage.getItem("Role_Name")
        this.Role_Id = sessionStorage.getItem("Role_Id")
        console.log('this.Role_Name',this.Role_Name);
    },
    methods: {
      handleInput() {
        console.log('输入内容:', this.Role_Name);
      },
      handleStatusChange(value){
        console.log('value',value);
        console.log('this.Role_Status',this.Role_Status);
      },
      submitForm(formName) {
        let _this = this
        console.log('this.Role_Status',_this.Role_Status);
        this.$refs[formName].validate((valid) => {
          if (valid) {
            _this.loading = true
            $.ajax({
              url: BASE_URL+'/weixin/updateRoleInfo',
              type: 'POST',
              contentType: 'application/json',
              data: JSON.stringify({
                Role_Name: _this.Role_Name,
                Role_Attribute: '',
                Role_Id:_this.Role_Id,
                Role_Status:_this.Role_Status
              }),
              success: function (res) {
                console.log(res);
                if (res == 'success') {
                  _this.$message.success("提交成功")
                  window.location.href = './SentPerson.html'
                } else {
                  _this.$message.error("提交失败，请稍后再试")
                }
              },
              error: function () {
                _this.$message.error("操作失败，请稍后再试")
              },
              complete: function (XMLHttpRequest) {
                _this.loading = false
                if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                  window.parent.document.location.href = "../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
                }
              }
            })
          } else {
            console.log("error submit!!");
            return false;
          }
  
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      },
    }
  })